********************************************************************************************************************************
***   Replication file for:                                                                                                  ***
***   Berbee, P., Braun, S. T. and Franke, R. (2024). Reversing Fortunes of German Regions, 1926-2019. JoEG.			     ***
***   							                                                                                             ***
***   SCRIPT: 	1_descriptives.do				   																			 ***	
***   PURPOSE: 	Generates the figures in Section 1 ("Introduction").													 	 ***
***	  																														 ***
***	  Tables:	-																											 ***
***	  Figures:	1, 2																										 ***
********************************************************************************************************************************



************

* Preamble (unnecessary when executing run.do)
run "$reversing/scripts/programs/_config.do"

************
* Code begins
************

use "$reversing/processed/workingdataset.dta", clear


************
* Figure 1
* Per capita income rank of West German labor markets in 1926 and 2019

keep labor_market_id labor_market_name year rank_perc realpcGDP realturnoverpc change_perc_2619 empshare_ind_1882_std north1 
reshape wide rank_perc realpcGDP realturnoverpc, i(labor_market_id) j(year)

*** Figure with 45 degree and regression line
#delimit ;	
		twoway (scatter rank_perc2019 rank_perc1926, sort mcolor(gs6%50))
		(line rank_perc2019 rank_perc2019 if north1 == 0, sort lcolor(black) lpattern(dot))
		(lfit rank_perc2019 rank_perc1926, sort lcolor(red)),
		xtitle("Percentile rank 1926", size(normal) margin(small))
		ytitle("Percentile rank 2019", size(normal) margin(small))
		plotregion(style(none) lcolor(none))  
		xlabel(0(10)100, nogrid) 
		ylabel(0(10)100, nogrid)
		graphregion(fcol(white) lcol(white)) 
		yline(50, lcolor(gs10) lpattern(dash))
		xline(50, lcolor(gs10) lpattern(dash))
		legend(off)
;
#delimit cr	

graph export "$reversing/results/figures/fig1.eps", replace

corr rank_perc2019 rank_perc1926 


************
* Figure 2
* Industrial employment in 1882 and per capita income rank change in 1926-2019


#delimit ;	
		twoway (scatter change_perc_2619 empshare_ind_1882_std, sort mcolor(gs6%50) legend(off))
		(lfit change_perc_2619 empshare_ind_1882_std, sort lcolor(red) legend(off)), 
		xtitle("Employment share industry 1882 (standardized)", size(normal) margin(small))
		ytitle("Percentile rank change 1926-2019", size(normal) margin(small))
		plotregion(style(none) lcolor(none))  
		xlabel(-1(1)5, nogrid) 
		ylabel(-100(40)100, nogrid)
		graphregion(fcol(white) lcol(white)) 
;
#delimit cr	

graph export "$reversing/results/figures/fig2.eps", replace



*** EOF



